/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pojos;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author A7med Kotb
 */
@Entity
@Table(name = "jobs_titles")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "JobsTitles.findAll", query = "SELECT j FROM JobsTitles j"),
    @NamedQuery(name = "JobsTitles.findByJobTitleId", query = "SELECT j FROM JobsTitles j WHERE j.jobTitleId = :jobTitleId"),
    @NamedQuery(name = "JobsTitles.findByJobTitle", query = "SELECT j FROM JobsTitles j WHERE j.jobTitle = :jobTitle")})
public class JobsTitles implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "job_title_id")
    private Integer jobTitleId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "job_title")
    private String jobTitle;
    @Basic(optional = false)
    @NotNull
    @Lob
    @Size(min = 1, max = 65535)
    @Column(name = "job_title_description")
    private String jobTitleDescription;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "role")
    private Collection<SourceCode> sourceCodeCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "jobTitle2")
    private Collection<Employees> employeesCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "jobTitle1")
    private Collection<Employees> employeesCollection1;

    public JobsTitles() {
    }

    public JobsTitles(Integer jobTitleId) {
        this.jobTitleId = jobTitleId;
    }

    public JobsTitles(Integer jobTitleId, String jobTitle, String jobTitleDescription) {
        this.jobTitleId = jobTitleId;
        this.jobTitle = jobTitle;
        this.jobTitleDescription = jobTitleDescription;
    }

    public Integer getJobTitleId() {
        return jobTitleId;
    }

    public void setJobTitleId(Integer jobTitleId) {
        this.jobTitleId = jobTitleId;
    }

    public String getJobTitle() {
        return jobTitle;
    }

    public void setJobTitle(String jobTitle) {
        this.jobTitle = jobTitle;
    }

    public String getJobTitleDescription() {
        return jobTitleDescription;
    }

    public void setJobTitleDescription(String jobTitleDescription) {
        this.jobTitleDescription = jobTitleDescription;
    }

    @XmlTransient
    public Collection<SourceCode> getSourceCodeCollection() {
        return sourceCodeCollection;
    }

    public void setSourceCodeCollection(Collection<SourceCode> sourceCodeCollection) {
        this.sourceCodeCollection = sourceCodeCollection;
    }

    @XmlTransient
    public Collection<Employees> getEmployeesCollection() {
        return employeesCollection;
    }

    public void setEmployeesCollection(Collection<Employees> employeesCollection) {
        this.employeesCollection = employeesCollection;
    }

    @XmlTransient
    public Collection<Employees> getEmployeesCollection1() {
        return employeesCollection1;
    }

    public void setEmployeesCollection1(Collection<Employees> employeesCollection1) {
        this.employeesCollection1 = employeesCollection1;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (jobTitleId != null ? jobTitleId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof JobsTitles)) {
            return false;
        }
        JobsTitles other = (JobsTitles) object;
        if ((this.jobTitleId == null && other.jobTitleId != null) || (this.jobTitleId != null && !this.jobTitleId.equals(other.jobTitleId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pojos.JobsTitles[ jobTitleId=" + jobTitleId + " ]";
    }
    
}
